package com.heng.locks;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

public class InterruptDemo8 {

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            for (int i = 1; i <= 300; i++) {
                System.out.println("---:" + i);
            }
            System.out.println("t1线程调用interrupt()后的中断标识02：" + Thread.currentThread().isInterrupted());
        }, "t1");
        t1.start();

        System.out.println("t1线程默认的中断标识"+t1.isInterrupted());//false

        try{TimeUnit.MILLISECONDS.sleep(1);}catch (InterruptedException e){e.printStackTrace();}

        t1.interrupt();

//        try{TimeUnit.MILLISECONDS.sleep(2000);}catch (InterruptedException e){e.printStackTrace();}
        System.out.println("t1线程调用interrupt()后的中断标识01：" + t1.isInterrupted());//为啥我的是false

//
//        System.out.println("t1线程调用interrupt()后的中断标识03：" + Thread.currentThread().isInterrupted());

    }



//线程与线程之间的协作
}
